#ifndef DCMIMPORTWIDGET_H
#define DCMIMPORTWIDGET_H

#include <QWidget>
#include <QUrl>
#include "dcmimportplugin_global.h"
#include "dcmimportinterface.h"
struct StudyRecord;
class ImportStudyModel;
class ImportDcmFileThread;

namespace Ui {
class DcmImportWidget;
}

class DCMIMPORTPLUGINSHARED_EXPORT DcmImportWidget : public QWidget, public DcmImportInterface
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID DcmImportPlugin_iid)
    Q_INTERFACES(DcmImportInterface)

public:
    explicit DcmImportWidget(QWidget *parent = 0);
    ~DcmImportWidget();

    QObject *getObject() { return this; }
    void setDcmImportHook(DcmImportProc proc, void *userData) { m_proc = proc; m_userData = userData; }

private slots:
    void on_fileButton_clicked();
    void on_folderButton_clicked();
    void on_importButton_clicked(bool checked);
    void onImportFinished();
    void onScanFinished();
    void onScanResultReady();
    void onImportResultReady(StudyRecord *study);
    void onImportFileTransferred();

private:
    void initNetwork();
    void scanDirHelpper(QStringList &files, const QString &dir);
    void scanFiles(const QStringList &files);

    Ui::DcmImportWidget *ui;
    ImportStudyModel *m;
    ImportDcmFileThread *t;

    int importedStudies;
    int importedImages;

    DcmImportProc m_proc;
    void *m_userData;
};

#endif // DCMIMPORTWIDGET_H
